<?php

namespace App\Package\Inspection;

class Examine
{
	/**
	 * 判断报岗状态
	 *
	 * Date: 12/05/2018
	 * @author George
	 * @param string $report_time
	 * @param string $time
	 * @param int $delayed
	 * @return bool
	 */
	public static function punctuality(string $report_time, string $time, int $delayed)
	{
		$delayed = $delayed * 60;
		$report_timestamp = strtotime($report_time);
		$timestamp = strtotime($time);

		// 如果报岗时间减去误差范围依然大于指定的时间 或 报岗时间加上误差范围任然小于指定的时间则视为没有准时报岗
		if ($report_timestamp - $delayed > $timestamp || $report_timestamp + $delayed < $timestamp) {
			return false;
		}
	}
}
